import request from "@/utils/request";

import type {
  GetTrademarkListApiResponse,
  TrademarkItem,
  TrademarkList,
} from "@/api/product/modles/trdemarkModel";

// 使用可枚举定义数据地址
enum Api {
  getTrademarkList = "/admin/product/baseTrademark", //品牌管理
  saveTrademark = "/admin/product/baseTrademark/save", // 添加品牌
  getBaseTrademark = "/admin/product/baseTrademark/update", //修改品牌
  delTrademark = "/admin/product/baseTrademark/remove", // 删除品牌
  getAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
}

// 品牌管理
export const getTrademarkListApi = (page: number, limit: number) => {
  return request.get<any, GetTrademarkListApiResponse>(
    `${Api.getTrademarkList}/${page}/${limit}`
  );
};

// 添加品牌

export const saveTrademarkApi = (tmName: string, logoUrl: string) => {
  return request.post<any, null>(Api.saveTrademark, {
    tmName,
    logoUrl,
  });
};

// 修改品牌

export const getUpdateTrademarkApi = (tm: TrademarkItem) => {
  return request.put<any, null>(Api.getBaseTrademark, tm);
};

// 删除品牌
export const gitDelTrademarkApi = (id: number) => {
  return request.delete(`${Api.delTrademark}/${id}`);
};


// 获取所有的品牌列表

export const getAllTrademarkListApi = () =>{
  return request.get<any, TrademarkList>(Api.getAllTrademarkList);
}